package com.trz.cqrs.core.service.impl;


import com.trz.cqrs.es.event.EventProcessor;
import com.trz.cqrs.core.repository.EventRepository;
import com.trz.cqrs.core.service.EventStore;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Slf4j
@Service
public class EventStoreImpl implements EventStore {

    @Resource
    private EventProcessor processor;

    @Override
    public void triggerEvent(Long id) {
        processor.trigger(() -> id);
        log.info("Event {} was triggered successfully", id);
    }

}
